<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>

<script>
  //设置一个机器点data 和 热力图的点data
  var machineSitedata = [
    [39.959228, 116.367874],
    [39.984486, 116.427612],
    [39.988169, 116.279984],
    [39.847558, 116.402893],
    [39.941857, 116.383667],
    [40.022882, 116.551208],
    [39.819085, 116.581421],
    [39.924482, 116.205826],
    [39.757880, 116.162567],
    [39.631606, 116.325989],
    [39.797986, 116.415253],
    [40.117990, 116.416626],
    [40.271668, 116.638412],
    [40.143190, 116.236038],
    [39.928168, 116.515503],
    [39.902362, 116.389160],
    [39.935539, 116.377487]
  ];
  function getHeatData(cnt, max, min) {
    let data = [];
    let center = {
      lat: 39.9,
      lng: 116.4
    };
    cnt = cnt || 100;
    max = max || 100;
    min = min || 0;
    // for (let index = 0; index < cnt; index++) {
    //   let r = Math.random();
    //   let angle = Math.random() * Math.PI * 2;
    //   let heatValue = Math.random() * (max - min) + min;
    //   data.push({
    //     lat: center.lat + r * Math.sin(angle),
    //     lng: center.lng + r * Math.cos(angle),
    //     value: heatValue
    //   });
    // }
    for (let index = 0; index < machineSitedata.length; index++) {
      let r = Math.random();
      let angle = Math.random() * Math.PI * 2;
      let heatValue = Math.random() * (max - min) + min;
      data.push({
        lat: machineSitedata[index][0],
        lng: machineSitedata[index][1],
        value: heatValue
      });
    }
    return {
      max: max,
      min: min,
      data: data
    }
  };
  console.log(getHeatData())
</script>
</body>
</html>